window.onload = function () {
    var box = document.getElementsByClassName("box")[0];
    box.style.background = "red";
}